import { ApiCall } from "tsrpc";
import { ReqResetting, ResResetting } from "../../../shared/master/strengthen/PtlResetting";
import { player } from "../../../model/fight/body/player";
import { template } from "../../../shared/master/MsgAction";
import manage_EquipStrengthen from "../../model/manage/manage_EquipStrengthen";

export default async function (call: ApiCall<ReqResetting, ResResetting>) {
    let user = call.req._player as player;
    let e = manage_EquipStrengthen.get(user.uuid);
    if (!e) {
        user.sendMsg(template.default, '铁匠铺内还没有放入装备哦~\n💡铁匠铺中的装备为您最后一次在装备栏/背包查看的装备')
        call.error('')
        return;
    }
    let res = user.check_wallet(0, 0, [{ id: 'prop-14', v: 1 }], false, '铁匠铺·重铸装备', true);
    if (!res.state) {
        return;
    }
    manage_EquipStrengthen.resetting(user, e)
    call.succ({})
}